package com.itheim.array;
/*
   数组索引查找
 */

import java.util.Scanner;

public class ArrayDemo05 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        //建立数组并进行静态初始化
        int[] arr = new int[]{25,35,45,55,65};
        System.out.println("请输入需要查询的值:");
        //定义索引变量
        int j = -1;
        int num= sc.nextInt();
        //循环对比
        for(int i = 0;i<5;i++) {
            if (num == arr[i]) {
                j = i;
                break;
            }
        }
        System.out.println(j);
    }
}
